#include "sys_Debug.h"
#include "usart.h"

int printk(const char *format, ...)
{
    char buf[VA_LIST_BUFF_SIZE] = {0};
    va_list ap;
    va_start(ap, format);
    vsprintf(buf, format, ap);
    while (HAL_UART_GetState(&huart1) == HAL_UART_STATE_BUSY_TX)
        ;
    HAL_UART_Transmit(&huart1, (uint8_t *)buf, strlen(buf), 20);
    va_end(ap);
    return 0;
}
